package com.ninthgroup.controller;


import com.ninthgroup.entity.User;
import com.ninthgroup.service.UserService;
import com.ninthgroup.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @param
 * @create by: 1452863884@qq.com rcg
 * @description: 注册控制
 * @create time: 2022/10/21 13:58
 * @return
 */
@RestController
@RequestMapping("/register")
public class RegisterController {

    @Autowired
    private UserService userService;

    @RequestMapping("/zhuce")
    @ResponseBody
    public Result register(@RequestBody User user) {

        int edit = userService.add(user);

        if (edit > 0) {
            Result result = new Result(2000, "注册成功");
            return result;
        }

        Result result = new Result(5000, "注册失败");
        return result;

    }

}